package com.itboye.ihomebank.responsitory;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.gson.reflect.TypeToken;
import com.itboye.ihomebank.base.BaseNetRepository;
import com.itboye.ihomebank.base.ICompleteListener;
import com.itboye.ihomebank.base.SystemMessBean;
import com.itboye.ihomebank.bean.BindCardsList;
import com.itboye.ihomebank.bean.ConfigBean;
import com.itboye.ihomebank.bean.DownKeyBean;
import com.itboye.ihomebank.bean.HeTongBean;
import com.itboye.ihomebank.bean.KaiSuoJiLu;
import com.itboye.ihomebank.bean.KeyBean;
import com.itboye.ihomebank.bean.KeyOfLockBean;
import com.itboye.ihomebank.bean.LunBoBean;
import com.itboye.ihomebank.bean.MyCollectionBean;
import com.itboye.ihomebank.bean.MyWalletBean;
import com.itboye.ihomebank.bean.PayInfo;
import com.itboye.ihomebank.bean.PersonDataBean;
import com.itboye.ihomebank.bean.QianYueDetailBean;
import com.itboye.ihomebank.bean.RegisterBean;
import com.itboye.ihomebank.bean.ZouShiBean;
import com.itboye.ihomebank.interfaces.IUserInterface;
import com.itboye.ihomebank.net.BaseErrorListener;
import com.itboye.ihomebank.net.BaseSuccessReqListener;
import com.itboye.ihomebank.net.ByJsonRequest.Builder;

/***
 * 请求网络类
 * 
 * @author admin
 * 
 */
public class UserRepository extends BaseNetRepository implements
		IUserInterface<PersonDataBean> {
	String api = "100";
	String loginTypeKey = "BY_User_login";// 用户登录
	String sendTypeKey = "BY_Message_send_sms";// 发送短信
	String verificationTypeKey = "BY_Message_checkCode";// 验证验证码
	String registerTypeKey = "BY_User_register";// 注册
	String backPassTypeKey = "BY_User_findPswByMobile";// 手机找回密码
	String updateTypeKey = "BY_User_update";// 更新用户信息
	String UploadPicturesTypeKey = "BY_File_upload";// 图片上传
	String systemMessage = "BY_Message_query";// 获取系统消息
	String UpdatePwdByPwd = "BY_User_updatePsw";// 修改密码（通过原密码修改）
	String FindPwdByPhone = "BY_User_findPswByMobile";// 找回密码（通过手机号码找回）
	String oritation = "BY_Config_position";// 获取方向
	String house_addKey = "BY_House_add";// 发布房源
	String renzhengKey = "BY_User_verifyApply";// 实名认证
	String messageKey = "BY_Message_query";// 消息分页查询
	String bindKeJiXia = "BY_Sciener_reg";// 绑定科技侠
	String myKey = "BY_Sciener_listUserKey";// 查询我的钥匙
	String updateKey = "BY_Sciener_edit";// 修改钥匙名字
	String heTongParams = "BY_Contract_getParams";// 获取填写合同参数
	String tiJiaoHeTong = "BY_Contract_write";// 提交合同
	String queRenHeTong = "BY_Contract_confirm";// 确认合同
	String orderDetail = "BY_Contract_detail";// 订单详情
	String myCollection = "BY_favorites_show";// 我的收藏
	String getYwHistory = "BY_Message_ywHis";// 获取历史
	String siliao = "BY_Message_ywPush";// 私聊
	String ywContactName = "BY_Message_ywRelation";// 获取联系人列表
	String payHouse = "BY_Pay_payInfo";// 预支付
	String sendKey = "BY_Sciener_sendKey";// 发送钥匙
	String sendPwd = "BY_Sciener_getKeyboardPwd";// 发送密码
	String kaiSuoJiLu = "BY_Sciener_listRecord";// 开锁记录
	String keyOfLock = "BY_Sciener_listKey";// 锁的钥匙列表
	String deleteKey = "BY_Sciener_deleteKey";// 用户删除钥匙
	String unbindAdmin = "BY_Sciener_unbindAdmin";// 解绑管理员
	String downKey = "BY_Sciener_downKey";// 下载钥匙
	String lockKey = "BY_Sciener_lockKey";// 冻结钥匙
	String unlockKey = "BY_Sciener_unlockKey";// 解冻钥匙
	String zhiFuPass = "BY_Wallet_updatePsw";// 支付密码
	String zhiFuPassYanZheng = "BY_Wallet_checkPsw";// 验证支付密码
	String shouquan = "BY_Sciener_auth";// 授权新用户
	String uploadJiLu = "BY_Sciener_unlock";// 上传开锁记录

	String myWallet = "BY_wallet_balance";// 我的钱包
	String updateWalletPws = "BY_Wallet_updatePsw";// 修改支付密码
	String walletCheckPsw = "BY_Wallet_checkPsw";// 验证支付密码
	String WalletBindBankCard = "BY_Wallet_bindBankCard";// 绑定银行卡

	String WalletUnBindBankCard = "BY_Wallet_deleteBankCard";// 解除绑定银行卡
	String bankType = "BY_Wallet_getBank";// 获取银行卡的类型
	String bankList = "BY_Wallet_bankCardList";// 已绑定银行卡列表
	String tixian = "BY_Wallet_withdraw";// 申请提现
	String lunbo = "BY_File_banner";// 轮播
	String yanzhengrf = "BY_pay_rfpaySendSms";//
	String yzyue = "BY_Wallet_checkPsw";// 验证余额密码
	String zoushi = "BY_house_communityRateChart";// 小区价格走势
	String queryUserByPhone = "BY_User_infoByMobile";// 通过手机得到账户
	String zhuanzhang = "BY_Wallet_transfer";// 转账
	String personData = "BY_User_info";// 获取个人数据

	public UserRepository(ICompleteListener iCompleteListener) {

		super(iCompleteListener);
	}

	@Override
	public void login(String userName, String pwd) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<PersonDataBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("username", userName);
		map.put("password", pwd);
		(new Builder<PersonDataBean>())
				.setTypeVerParamsAndReturnClass(loginTypeKey, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<PersonDataBean>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	/**
	 * 发送短信
	 */
	@Override
	public void send(String phone, String code) {
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("mobile", phone);
		map.put("code_type", code);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(sendTypeKey, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	/**
	 * 验证验证码
	 */
	@Override
	public void verification(String mobile, String code_type, String code) {
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("mobile", mobile);
		map.put("code_type", code_type);
		map.put("code", code);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(verificationTypeKey, apiVer,
						map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	/**
	 * 注册
	 */
	@Override
	public void register(String reg_type, String from, String code,
			String username, String password) {
		Type type = new TypeToken<RegisterBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("reg_type", reg_type);
		map.put("from", from);
		map.put("code", code);
		map.put("username", username);
		map.put("password", password);
		(new Builder<RegisterBean>())
				.setTypeVerParamsAndReturnClass(registerTypeKey, apiVer, map,
						type)
				.requestListener(
						new BaseSuccessReqListener<RegisterBean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	/**
	 * 手机找回密码
	 */
	@Override
	public void backPass(String mobile, String code, String psw) {
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("mobile", mobile);
		map.put("code", code);
		map.put("psw", psw);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(backPassTypeKey, apiVer, map,
						type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	/**
	 * 修改性别
	 */
	@Override
	public void updateSex(String uid, String sex) {
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("sex", sex);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(updateTypeKey, apiVer, map,
						type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	/**
	 * 修改昵称
	 */
	@Override
	public void updateNickname(String uid, String nickname) {
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("nickname", nickname);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(updateTypeKey, apiVer, map,
						type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	/**
	 * 修改头像
	 */
	@Override
	public void updateHead(String uid, String type, String image) {
		Type type01 = new TypeToken<String>() {
		}.getType();

		String apiver = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("type", type);
		map.put("image", image);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(UploadPicturesTypeKey, apiver,
						map, type01)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	/***
	 * 得到系统配置
	 */
	@Override
	public void getConfig() {
		// TODO Auto-generated method stub
		Type type01 = new TypeToken<ConfigBean>() {
		}.getType();

		String apiver = api;
		Map<String, Object> map = new HashMap<String, Object>();
		(new Builder<ConfigBean>())
				.setTypeVerParamsAndReturnClass("BY_Config_app", apiver, map,
						type01)
				.requestListener(
						new BaseSuccessReqListener<ConfigBean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	/***
	 * 绑定手机或者修改绑定手机
	 */
	@Override
	public void bindPhone(String uid, String phone, String code,
			String password, boolean isChange) {
		// TODO Auto-generated method stub
		Type type01 = new TypeToken<String>() {
		}.getType();

		String apiver = api;
		String typeKey = "";
		if (isChange) {
			typeKey = "BY_User_bind";
		} else {
			typeKey = "BY_User_changePhone";
		}
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("mobile", phone);
		map.put("code", code);
		map.put("password", password);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(typeKey, apiver, map, type01)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	/**
	 * 密码修改
	 */
	@Override
	public void updatePwdByPwd(String uid, String oldPassword,
			String newPassword) {
		// TODO Auto-generated method stub
		Type type01 = new TypeToken<String>() {
		}.getType();

		String apiver = api;
		Map<String, Object> map = new HashMap<String, Object>();
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(UpdatePwdByPwd, apiver, map,
						type01)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	/**
	 * 手机找密
	 */
	@Override
	public void updatePwdByPhone(String uid, String mobile, String code,
			String newPassword) {
		// TODO Auto-generated method stub
		Type type01 = new TypeToken<String>() {
		}.getType();

		String apiver = api;
		Map<String, Object> map = new HashMap<String, Object>();
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(FindPwdByPhone, apiver, map,
						type01)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	/***
	 * 获取系统消息
	 */
	@Override
	public void systemMessage(String uid, String msgType) {
		// TODO Auto-generated method stub
		Type type01 = new TypeToken<String>() {
		}.getType();

		String apiver = api;
		Map<String, Object> map = new HashMap<String, Object>();
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(systemMessage, apiver, map,
						type01)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void getDirection() {
		// TODO Auto-generated method stub
		Type type01 = new TypeToken<String>() {
		}.getType();

		String apiver = api;
		Map<String, Object> map = new HashMap<String, Object>();
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(oritation, apiver, map, type01)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	/**
	 * 发布房源
	 */
	public void getHouseAdd(String uid, String imgs, String community_code,
			int rent_type, String contact_name, String contact_phone,
			String rent, String size, String unit, String house_floor,
			String floors, String house_decoration, String house_pay,
			String house_dir, String address, String entrust_money,
			String house_feature, String house_device, String addressdetail,
			String house_no, String deposit) {
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("imgs", imgs);
		map.put("community_code", community_code);
		map.put("rent_type", rent_type);
		map.put("contact_name", contact_name);
		map.put("contact_phone", contact_phone);
		map.put("rent", rent);
		map.put("size", size);
		map.put("unit", unit);
		map.put("house_floor", house_floor);
		map.put("floors", floors);
		map.put("house_decoration", house_decoration);
		map.put("house_pay", house_pay);
		map.put("house_dir", house_dir);
		map.put("address", address);
		map.put("entrust_money", entrust_money);
		map.put("house_feature", house_feature);
		map.put("house_device", house_device);
		map.put("house_no", house_no);
		map.put("deposit", deposit);
		// map.put("address", addressdetail);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(house_addKey, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	/**
	 * 实名认证
	 */
	public void getRealName(String uid, String realname, String idnumber,
			String bank_no, String bank_phone, String code) {
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("realname", realname);
		map.put("idnumber", idnumber);
		map.put("bank_no", bank_no);
		map.put("bank_phone", bank_phone);

//		map.put("code", code);

		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(renzhengKey, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	/**
	 * 消息分页查询
	 */
	@Override
	public void getSystemMess(String uid, String msg_type, String page_no,
			String page_size) {

		Type type = new TypeToken<SystemMessBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("msg_type", msg_type);
		map.put("page_no", page_no);
		map.put("page_size", page_size);

		(new Builder<SystemMessBean>())
				.setTypeVerParamsAndReturnClass(messageKey, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<SystemMessBean>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	@Override
	public void bindKeJiXia(String uid, boolean isBind) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		// map.put("name", name);
		// map.put("pass", pass);
		if (!isBind) {
			bindKeJiXia = "BY_Sciener_unbind";
		}
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(bindKeJiXia, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	@Override
	public void myKey(String uid) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<List<KeyBean>>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		(new Builder<List<KeyBean>>())
				.setTypeVerParamsAndReturnClass(myKey, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<List<KeyBean>>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void updateKey(String uid, String lockId, String alias) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("lock_id", lockId);
		map.put("alias", alias);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(updateKey, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void heTongParams(String subject, String contract_no) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<List<HeTongBean>>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("subject", subject);
		map.put("contract_no", contract_no);
		(new Builder<List<HeTongBean>>())
				.setTypeVerParamsAndReturnClass(heTongParams, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<List<HeTongBean>>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void tiJiaoHeTong(String uid, String contractNo, String params) {
		// TODO Auto-generated method stub

		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("contract_no", contractNo);
		map.put("params", params);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(tiJiaoHeTong, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void wanChengHeTong(String uid, String contractNo) {
		// TODO Auto-generated method stub

		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("contract_no", contractNo);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(queRenHeTong, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void qianyueDetail(String uid, String contractNo) {
		// TODO Auto-generated orderDetail

		Type type = new TypeToken<QianYueDetailBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("contract_no", contractNo);
		(new Builder<QianYueDetailBean>())
				.setTypeVerParamsAndReturnClass(orderDetail, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<QianYueDetailBean>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void myCollection(String uid, String status) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<List<MyCollectionBean>>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("status", status);
		(new Builder<List<MyCollectionBean>>())
				.setTypeVerParamsAndReturnClass(myCollection, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<List<MyCollectionBean>>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	@Override
	public void getYWContactName(String uid, String startDate, String endDate) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<List<MyCollectionBean>>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("begin", startDate);
		map.put("end", endDate);
		(new Builder<List<MyCollectionBean>>())
				.setTypeVerParamsAndReturnClass(ywContactName, apiVer, map,
						type)
				.requestListener(
						new BaseSuccessReqListener<List<MyCollectionBean>>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void siLiao(String uid, String toUid, String msg) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<List<MyCollectionBean>>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("to_uid", toUid);
		map.put("msg", msg);
		(new Builder<List<MyCollectionBean>>())
				.setTypeVerParamsAndReturnClass(siliao, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<List<MyCollectionBean>>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void getSiXinHistory(String uid, String toUid, String begin,
			String end, String count, String next) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<List<MyCollectionBean>>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("to_uid", toUid);
		map.put("begin", begin);
		map.put("end", end);
		map.put("count", count);
		map.put("next", next);

		(new Builder<List<MyCollectionBean>>())
				.setTypeVerParamsAndReturnClass(getYwHistory, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<List<MyCollectionBean>>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void payHouse(String uid, String pay_code_type, String items,
			String pay_type, String wallet_pay_money, String money,
			String wallet_only) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<PayInfo>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("pay_code_type", pay_code_type);
		map.put("items", items);// 订单编号
		map.put("pay_type", pay_type);// 余额,int,分, - (传0,暂未实现)//
										// 第三方支付方式，int,[0=>无第三方(todo),1=>支付宝，2=>微信(todo)，3=>融丰(todo)]
		map.put("wallet_pay_money", wallet_pay_money);
		map.put("wallet_only", wallet_only);
		map.put("amount", money);

		(new Builder<PayInfo>())
				.setTypeVerParamsAndReturnClass(payHouse, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<PayInfo>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void sendKey(String uid, String toUid, String lockId, String start,
			String end, String mark) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("to_mobile", toUid);//
		map.put("lock_id", lockId);//
		map.put("start", start);//
		map.put("end", end);
		map.put("mark", mark);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(sendKey, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void sendPwd(String uid, String toUid, String lockId, String start,
			String end) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<PayInfo>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("to_uid", toUid);//
		map.put("lock_id", lockId);//
		map.put("start", start);//
		map.put("end", end);
		(new Builder<PayInfo>())
				.setTypeVerParamsAndReturnClass(sendPwd, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<PayInfo>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void keisuojilu(String uid, String lockId, String page,
			String pageSize) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<List<KaiSuoJiLu>>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("lock_id", lockId);//
		map.put("page", page);//
		map.put("pageSize", pageSize);
		(new Builder<List<KaiSuoJiLu>>())
				.setTypeVerParamsAndReturnClass(kaiSuoJiLu, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<List<KaiSuoJiLu>>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void keyOfLock(String uid, String lockId) {
		// TODO Auto-generated method stub

		Type type = new TypeToken<List<KeyOfLockBean>>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("lock_id", lockId);
		(new Builder<List<KeyOfLockBean>>())
				.setTypeVerParamsAndReturnClass(keyOfLock, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<List<KeyOfLockBean>>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void deleteKey(String uid, String toUid, String keyId, String lockId) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("lock_id", lockId);
		map.put("to_uid", toUid);
		map.put("key_id", keyId);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(deleteKey, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void unbindLock(String uid, String lockId) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("lock_id", lockId);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(unbindAdmin, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void downLoadKey(String uid, String keyId, String lockId) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<DownKeyBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("lock_id", lockId);
		map.put("key_id", keyId);
		(new Builder<DownKeyBean>())
				.setTypeVerParamsAndReturnClass(downKey, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<DownKeyBean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void lockKey(String uid, String toUid, String keyId, String lockId,
			int type) {
		// TODO Auto-generated method stub
		Type typeClass = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("lock_id", lockId);
		map.put("to_uid", toUid);
		map.put("key_id", keyId);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(
						type == 0 ? unlockKey : lockKey, apiVer, map, typeClass)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	/**
	 * 修改支付密码
	 */
	@Override
	public void updataZhiFu(String uid, String old_psw, String new_psw) {
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("old_psw", old_psw);
		map.put("new_psw", new_psw);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(zhiFuPass, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	/**
	 * 支付密码验证
	 */
	@Override
	public void ZhiFuPassYanZheng(String uid, String psw) {
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("psw", psw);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(zhiFuPassYanZheng, apiVer, map,
						type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	@Override
	public void shouquan(String uid, String toUid, String lockId, String keyId,
			String startDate, String endDate) {
		// TODO Auto-generated method stub

		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("to_uid", toUid);
		map.put("lock_id", lockId);
		map.put("auth", keyId);
		map.put("start", startDate);
		map.put("end", endDate);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(shouquan, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void uploadHistoryOfUnlock(String uid, String lockId,
			String success, String opTime, String quentity) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("lock_id", lockId);
		map.put("success", success);
		map.put("op_time", opTime);
		map.put("quantity", quentity);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(uploadJiLu, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void myWallet(String uid) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<MyWalletBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		(new Builder<MyWalletBean>())
				.setTypeVerParamsAndReturnClass(myWallet, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<MyWalletBean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void updateWalletPsw(String uid, String oldPsw, String newPsw) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<MyWalletBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("old_psw", oldPsw);
		map.put("new_psw", newPsw);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(updateWalletPws, apiVer, map,
						type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void yzWalletPsw(String uid, String psw) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("psw", psw);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(walletCheckPsw, apiVer, map,
						type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void bindBankCard(String uid, String bank_no, String bank_account,
			String bank_cert, String bank_phone, String bank_cvv,
			String bank_yxq) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("bank_no", bank_no);
		map.put("bank_account", bank_account);
		map.put("bank_cert", bank_cert);
		map.put("bank_phone", bank_phone);
		map.put("bank_cvv", bank_cvv);
		map.put("bank_yxq", bank_yxq);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(WalletBindBankCard, apiVer,
						map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();

	}

	@Override
	public void getBankType(String bankNo) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<ArrayList<String>>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("bank_no", bankNo);
		(new Builder<ArrayList<String>>())
				.setTypeVerParamsAndReturnClass(bankType, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<ArrayList<String>>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void bankList(String uid) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<ArrayList<BindCardsList>>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		(new Builder<ArrayList<BindCardsList>>())
				.setTypeVerParamsAndReturnClass(bankList, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<ArrayList<BindCardsList>>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void unbindBankCard(String uid, String bankNo) {
		// TODO Auto-generated method stub

		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("bank_no", bankNo);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(WalletUnBindBankCard, apiVer,
						map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void tixian(String uid, String money, String cardNo) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("account_id", cardNo);
		map.put("money", money);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(tixian, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void rfPay(String uid, String code, String bankId) {
		// TODO Auto-generated method stub

	}

	@Override
	public void lunbo(String position) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<List<LunBoBean>>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("position", position);
		(new Builder<List<LunBoBean>>())
				.setTypeVerParamsAndReturnClass(lunbo, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<List<LunBoBean>>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void sendRf(Object orderCode, String code) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("order_no", orderCode);
		map.put("sms_code", code);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(yanzhengrf, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void yueYanzheng(String uid, String password) {
		// TODO Auto-generated method stub

		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("psw", password);
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(yzyue, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<String>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void zoushi(String community_id, String chart_type, String which,
			String house_room) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<ZouShiBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("community_id", community_id);
		map.put("chart_type", chart_type);
		map.put("which", which);
		map.put("house_room", house_room);
		(new Builder<ZouShiBean>())
				.setTypeVerParamsAndReturnClass(zoushi, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<ZouShiBean>(getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void queryUserByPhone(String phone) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<PersonDataBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("mobile", phone);
		(new Builder<PersonDataBean>())
				.setTypeVerParamsAndReturnClass(queryUserByPhone, apiVer, map,
						type)
				.requestListener(
						new BaseSuccessReqListener<PersonDataBean>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void zhuanzhang(String uid, String to_account, String balance,
			String trans_type) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<PersonDataBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		map.put("to_account", to_account);
		map.put("balance", balance);
		map.put("trans_type", trans_type);
		(new Builder<PersonDataBean>())
				.setTypeVerParamsAndReturnClass(zhuanzhang, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<PersonDataBean>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void getPersonData(String uid) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<PersonDataBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", uid);
		(new Builder<PersonDataBean>())
				.setTypeVerParamsAndReturnClass(personData, apiVer, map, type)
				.requestListener(
						new BaseSuccessReqListener<PersonDataBean>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

}
